Add SAML2 compatibility module with intelligent namespace conflict detection#104
Conversation
Co-authored-by: Subterrane <5290140+Subterrane@users.noreply.github.com>
Co-authored-by: Subterrane <5290140+Subterrane@users.noreply.github.com>
…3-saml is installed Co-authored-by: Subterrane <5290140+Subterrane@users.noreply.github.com>
I've updated the solution to handle your specific scenario where you already have The improved compatibility layer now detects when both packages are installed and provides specific guidance for resolving the conflict. You'll now see a helpful error message that explains the namespace conflict and offers several resolution options. The easiest solution for your case would be Option 1: if you only need SAML authentication, uninstall the Changes in commit 430278e. |
This PR addresses the common confusion where users install the
oneloginpackage but try to importOneLogin_Saml2_Authfromonelogin.saml2.auth, which actually belongs to the separatepython3-samlpackage. The solution now intelligently handles both scenarios: whenpython3-samlis not installed and when both packages are installed creating a namespace conflict.Problem
Users were encountering a confusing
ModuleNotFoundError: No module named 'onelogin.saml2'when trying to import:The issue is more complex when users have both
oneloginandpython3-samlpackages installed, creating a namespace conflict where the wrong package takes precedence.Solution
Added an intelligent compatibility layer that:
onelogin/saml2/__init__.pyandonelogin/saml2/auth.pypython3-samlpackage is installed on the systempython3-samlis detectedExamples
When python3-saml is not installed:
When python3-saml is installed (namespace conflict):
Changes
onelogin/saml2/__init__.pywith module documentationonelogin/saml2/auth.pywith intelligent conflict detection and context-aware error messagestest/test_saml2_import_compatibility.pycovering both scenariosThis is a minimal, surgical change that only adds helpful guidance without modifying any existing functionality, now with intelligent detection to handle the most common user scenarios.
Fixes #103.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.